package com.dlc.shop.jky.platform.controller;


import com.dlc.shop.bean.model.Product;
import com.dlc.shop.common.response.ServerResponseEntity;
import com.dlc.shop.service.ProductService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/productRu")
@Tag(name = "国外商品商品状态比对")
@AllArgsConstructor
public class ProductRuController {

    private final ProductService productService;

    @PostMapping("/info/{prodId}")
    @Operation(summary = "根据商品id获取商品状态", description = "根据商品id获取商品状态")
    public ServerResponseEntity<Integer> info(@PathVariable("prodId") Long prodId) {
        Product prod = productService.getProductById(prodId);
        if (prod == null){
            return ServerResponseEntity.success(10);
        }
        return ServerResponseEntity.success(prod.getStatus());
    }
}
